{{ if eq .Section "search" }}
<script defer src="https://cdn.jsdelivr.net/combine/npm/art-template@4.13.2/lib/template-web.min.js,npm/fuse.js@6.4.1"></script>
{{ else if eq .Section "archives" }}
{{ else }}
<script defer src="https://cdn.jsdelivr.net/combine/npm/medium-zoom@1.0.6,npm/lazysizes@5.2.2"></script>
<script defer src="https://cdn.jsdelivr.net/npm/prismjs@1.21.0/components/prism-core.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/prismjs@1.21.0/plugins/autoloader/prism-autoloader.min.js"></script>
{{ end }}
{{ $options := (dict "targetPath" "assets/js/fuji.min.js" "minify" true "target" "es2015" "format" "iife") }}
{{ $built := resources.Get "js/fuji.js" | js.Build $options }}
<script defer src="{{ $built.RelPermalink }}"></script>
{{ if or .Params.math .Site.Params.math }}
{{ partial "math.html" . }}
{{ end }}
{{ with .Params.player }}
<script src="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.js"></script>
<script>
    // in-post aplayer
    // prettier-ignore
    var aPlayer = new APlayer({
        container: document.getElementById('post-aplayer'),
        theme: '#8f82bc',
        volume: 0.1,
        listFolded: true,
        audio: [{{- range $.Params.player -}}
            {
                name: '{{ .playerName }}',
                artist: '{{ .playerArtist }}',
                url: '{{ .playerURL }}',
                cover: '{{ .playerCover }}'
            },
            {{- end -}}]
    });
    // aplayer toc anchors fix
    // see https://github.com/MoePlayer/APlayer/issues/242#issuecomment-602471423
    document.addEventListener('DOMContentLoaded', function () {
        var issueTocEle = document.querySelector('.sidebar-toc');
        if (issueTocEle) {
            var newTocEle = issueTocEle.cloneNode(true);
            issueTocEle.parentNode.replaceChild(newTocEle, issueTocEle);
        }
    });
</script>
{{ end }}